//
//  GRFMRemotePlayer.h
//  GRFMRemotePlayer_Example
//
//  Created by Guo Rui on 2018/1/15.
//  Copyright © 2018年 guorui. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef enum : NSUInteger {
    GRFMRemotePlayerStateUnKnow = 0,
    GRFMRemotePlayerStateLoading = 1,
    GRFMRemotePlayerStatePlaying,
    GRFMRemotePlayerStatePause,
    GRFMRemotePlayerStateStoped,
    GRFMRemotePlayerStateFailed
} GRFMRemotePlayerState;

@interface GRFMRemotePlayer : NSObject
// Control
- (void)playWithURL:(NSURL *)url isCache:(BOOL)isCache;
- (void)pause;
- (void)resume;
- (void)stop;

- (void)seekToProgress:(float)progress;
- (void)seekToTimeDiffer:(NSTimeInterval)timeDiffet;

// Data
@property (assign, nonatomic) GRFMRemotePlayerState state;

@property (assign, nonatomic) float rate;
@property (assign, nonatomic) float volume;
@property (assign, nonatomic) BOOL muted;

@property (nonatomic, assign, readonly) NSTimeInterval totalTime;
@property (nonatomic, assign, readonly) NSTimeInterval currentTime;
@property (copy, nonatomic, readonly) NSString *totalTimeFormat;
@property (copy, nonatomic, readonly) NSString *currentTimeFormat;

@property (assign, nonatomic, readonly) float progress;
@property (nonatomic, strong, readonly) NSURL *url;
@property (nonatomic, assign, readonly) float loadDataProgress;

@property (copy, nonatomic) void (^stateChange)(GRFMRemotePlayerState state);
@end
